package com.fr.lintcode;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 付荣
 * @version 创建时间：2019年1月31日 下午2:15:26
 */
public class Q1654 {
	/**
     * @param str: the str
     * @return: the sum that the letter appears the most
     */
    public int mostFrequentlyAppearingLetters(String str) {
    	Map<Character, Integer> map = new HashMap<>();
    	for(int i = 0; i < str.length(); i++){
    		char c = str.charAt(i);
    		Integer count = map.get(c);
    		if (count == null){
    			count = 1;
    		}else{
    			count ++;
    		}
    		map.put(c, count);
    	}
    	int rs = 0;
    	for(Integer i : map.values()){
    		if (i > rs){
    			rs = i;
    		}
    	}
    	return rs;
    }
}
